<!DOCTYPE html>
<html lang="zh">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>购物车布局</title>
  <link href="css/cart.css" rel="stylesheet">
</head>

<body>

  <div id="app" class="container">

    <!-- 空购物车界面 -->
    <div class="empty-cart-message">
      <div class="empty-cart-image"></div>
      您的购物车空空如也
      <a href="#" class="go-checkout">去购物</a>
    </div>


    <div class="cart">
      <h1>科泰淘购物车</h1>
      <div class="clearfix">
        <a href="javascript:void(0);" class="delete-selected" @click="delSelect">删除选中</a>
        <a href="javascript:void(0);" class="clear-cart" @click="delAll">清空购物车</a>
      </div>
      <div class="cart-item" v-for="(item, index) in cartList" :key="index">
        <div class="cart-item-details">
          <input type="checkbox" :checked="item.checked" v-model="item.checked" class="cart-item-checkbox">
          <img :src="item.imgUrl" :alt="item.goodsName">
          <div class="cart-item-name-sku">
            <div class="cart-item-name">{{item.goodsName}}</div>
            <div class="cart-item-sku">颜色：{{item.color}} 尺码：{{item.size}}</div>
          </div>
        </div>
        <div class="cart-item-quantity-price">
          <div class="cart-item-quantity">
            <button class="quantity-btn minus-btn" @click="subCount(item)">-</button>
            <input type="text" name="quantity" class="quantity" :v-model="item.count"  :value="item.count">
            <button class="quantity-btn plus-btn" @click="addCount(item)">+</button>
          </div>
          <div class="cart-item-price">{{item.price|formatPrice()}}</div>
        </div>
      </div>
      <div class="total-price-container">
        <div class="total-count">已选 <span class="count-value">{{selectCount}}</span> 件</div>
        <div class="total-price">总计：{{productAmount|formatPrice()}}</div>
      </div>

      <div class="clearfix">
        <div class="select-all-container">
          <input type="checkbox" id="select-all-checkbox" @click="selectAllFn" v-model="selectAll" class="cart-item-checkbox">
          <label for="select-all-checkbox" >全选</label>
        </div>
        <a href="#" class="go-checkout">去结算</a>
      </div>
    </div>

  </div>

  <script src="js/vue.js"></script>
  <script src="js/cart-vue.js"></script>
</body>

</html>